package com.ian.offer;

/**
 * @author zhangyaowen
 * @date 2021/2/21 12:16 上午
 */
public class ReverseLeftWords {


    public static String reverseLeftWords(String s, int n) {

          int N  = s.length();
          return   s.substring(n,N) + s.substring(0,n);

    }

    public static String reverseLeftWords2(String s, int n) {

        StringBuilder stringBuilder = new StringBuilder();
        for (int i = n; i < s.length(); i++) {
            stringBuilder.append(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            stringBuilder.append(s.charAt(i));
        }


        return stringBuilder.toString();
    }



    public static void main(String[] args) {


        System.out.println(reverseLeftWords("hello",2));
    }
}
